package org.developer.study.springboot.controller;

import org.apache.log4j.Logger;
import org.developer.study.springboot.entity.TInfo;
import org.developer.study.springboot.exception.BizServiceException;
import org.developer.study.springboot.service.DemoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.transaction.Transactional;

/**
 * 主要的controller类
 * Created by Administrator on 2017/1/25.
 */
@RestController
public class PrimaryController {
    private static Logger logger = Logger.getLogger(PrimaryController.class);
    @Autowired
    private DemoService demoService;

    @RequestMapping("/demo-return-exception")
    public void demoReturnException() {
        logger.info("/demo-teturn-data access");
        demoService.demo();
    }

    @RequestMapping("/demo-return-data")
    public String demoReturnData() {
        logger.info("/demo-teturn-data access");
        TInfo tInfo = demoService.findSpecifyInfo(4L);
        return "helloworld";  //return back json data
    }

}
